package globalVisionEntertainment.nba;

import java.util.Date;

/**
 * 表示一位球员在一节比赛中，一次在场的统计数据。 球员在一节比赛中可以上场下场多次，本类只表示其中的一次。 <code>PlayerQuarterStatistic</code>表示球员整一节的统计数据。
 * 
 * @author 爱让一切都对了
 * 
 */
public class PlayerInQuarterStatistic
{
	private final Date startTime;
	private Date endTime;
	String playerName;

	int enterMyScore;
	int leaveMyScore;
	int enterRivalScore;
	int leaveRivalScore;

	public PlayerInQuarterStatistic(String playerName, Date startTime)
	{
		this.startTime = startTime;
		this.playerName = playerName;
	}

	public Date getEnterTime()
	{
		return startTime;
	}

	public Date getLeaveTime()
	{
		return endTime;
	}

	public void setEndTime(Date endTime)
	{
		assert this.endTime == null;

		this.endTime = endTime;
	}

	public Date getOnCourtTime()
	{
		// TODO: maybe should not use Date, since Date is an instance of time, not a period.

		// startTime may be 12:00, endTime be 0:00.
		return new Date(startTime.getTime() - endTime.getTime());

	}

	public int getPlus()
	{
		return leaveMyScore - enterMyScore;
	}

	public int getMinus()
	{
		return leaveRivalScore - enterRivalScore;
	}

}
